package com.itheima.cs.common.schbd;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.widget.EditText;

import com.itheima.cs.R;

public class ManufacturingReportActivity extends AppCompatActivity {

    private EditText editTextSearch;
    private Handler mainHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_manufacturing_report);
        initView();
    }

    private void initView(){
        editTextSearch = findViewById(R.id.editText_search);
        editTextSearch.requestFocus();


        editTextSearch.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                // 文本改变时执行
                String input = s.toString();
                if (!TextUtils.isEmpty(input)) {
                    handleScanResult(input);
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });

        mainHandler = new Handler(getMainLooper());
    }

    private void handleScanResult(final String barcode) {

    }
}
